<?php
namespace addon\mall\validate;
use app\common\validate\ValidateBase;
use think\Db;
class Order extends ValidateBase
{
    // 验证规则
    protected $rule = [
        'goods_price'                   => 'require|float',         // 商品总价
        'order_amount'                  => 'require|float',         // 应付款金额
        'total_amount'                  => 'require|float',         // 订单总价
        'order_goods'                   => 'require'
    ];

    // 验证提示
    protected $message = [
        'goods_price.require'               => '商品总价不能为空',
        'order_amount.require'              => '应付款金额不能为空',
        'total_amount.require'              => '订单总价不能为空',
        'order_goods'                       => '订单产品必须有对应'
    ];

    // 应用场景
    protected $scene = [
        'add'=>['goods_price','order_amount','total_amount','order_goods'],
    ];
}